<?php
/**
 * Created by PhpStorm.
 * User: Will
 * Date: 2018/1/16
 * Time: 16:55
 */

class chatModel extends Model
{
    public function selfDataAction()
    {
        $self = isset($_SESSION['user']) ? $_SESSION['user'] : null;
        echo json_encode($self);
    }

    public function selectchatAction()
    {
        $avid = isset($_POST['avid']) ? $_POST['avid'] : 10000002;

        $sql = "select *,u.avatar as img from convercontent c left join user u on c.contentParId = u.id  where c.roomId = {$avid} order by contentDate desc limit 9";

        $str = $this->link->selectDB($sql);
//
//        var_dump($str);
        echo json_encode($str);
    }

}